const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderInfo: {},
    name: '',
    phone: '',
    express_de: "",
    shipment_number: '',
    Mail_refund: "",
    instructions: 2
  },

  onChange_pick(e) {
    console.log(e);
    this.setData({
      instructions:e.detail
    })
    console.log(this.data.instructions);

  },



  refund() {

    let {
      instructions,
      name,
      phone,
      express_de,
      shipment_number,
      Mail_refund,
    } = this.data
    let {
      order_type,
      order_id,
      store_id
    } = this.data.orderInfo

    let params = {
      instructions,
      name,
      phone,
      express_de,
      shipment_number,
      Mail_refund,
      code: order_type,
      order_id,
      store_id
    }
    console.log(params);
    app.request("/user/Mail_refund", {
      method: "POST",
      data: params
    }).then(res => {
      console.log(res);
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options);
    this.fetch(options.order_id)
  },

  fetch(order_id) {
    app.request("/user/search_haspayDetail", {
      data: {
        order_no: order_id
      }
    }).then(res => {
      this.setData({
        orderInfo: res.data.data[0],
      })
      console.log(res, "订单详情2");
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // let order_id = this.data.order_id
    // this.fetch(order_id)
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})